<?php

use App\Http\Admin\Controller\CommonController;
use Plugins\Demo\Http\Admin\Controller\IndexController;
use Sc\Util\HtmlStructure\Form;
use Sc\Util\HtmlStructure\Html\Html;

Html::create('Demo表单');

$form = Form::create("demoForm")->config(['label-width' => '80px']);

$form->addFormItems(
    Form\FormItem::text('name', '姓名'),
    Form\FormItem::text('phone', '手机号'),
    Form\FormItem::text('email', '邮箱'),
    Form\FormItem::upload('avatar', '头像')->setUploadUrl(sc_route([CommonController::class, 'upload'])),
    Form\FormItem::textarea('intro', '简介'),
    Form\FormItem::radio('sex', '性别', )->options( [
        '1' => '男',
        '2' => '女',
    ])->default('1'),
    Form\FormItem::submit()->submitUrl(
        sc_route([IndexController::class, 'demoForm']),
        sc_route([IndexController::class, 'demoForm']),
    )
);

return $form->render();